<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
      list-style: none;
      outline-style: none;
    }
    .box{
      width: 600px;
      border: 1px solid #000;
      padding: 20px;
      margin: 40px auto;
      
    }
    textarea{
      width: 450px;
      height: 150px;
      resize: none;
      padding: 10px;
    }
    ul{
      
      width: 450px;
      padding-left: 80px;
    }
    li{
      overflow: hidden;
      line-height: 25px;
      border-bottom: 1px dashed #ccc;
    }
    input{
      float: right;
    }
  </style>
</head>
<body>
  <div class="box">
    <span>微博发布</span>
    <textarea name="" id="" cols="30" rows="10"></textarea>
    <button>发布</button>
    <ul>
      <!-- <li>
        <input type="button" value="删除">
      </li> -->
    </ul>
  </div>
  <script src="../jquery-1.12.4.min.js"></script>
  <script>
    $('button').click(function(){
      var value = $('textarea').val()
      console.log(value)
      if(value.trim() === ''){
        alert('哥们,你没有写内容不能发布');
        return;
      };
      $('<li>'+value+'</li>').prependTo('ul')
      .append('<input type="button" value="删除">')
      .children().click(function(){
        $(this).parent().remove()
      });
      $('textarea').val('');
    })
  </script>
</body>
</html>